package net.hn.hnms.biz.safety.trinity.service;

import net.hn.hnms.biz.api.safety.trinity.model.StandardizedManagementVo;
import net.hn.hnms.biz.safety.trinity.dao.NormCheckScoreDao;
import net.hn.hnms.biz.safety.trinity.entity.NormCheckScore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 智呈物联 nzw
 * @date 2022/8/8
 */
@Service
public class NormCheckScoreService {

    NormCheckScoreDao normCheckScoreDao;

    @Autowired
    public void setNormCheckScoreDao(NormCheckScoreDao normCheckScoreDao) {
        this.normCheckScoreDao = normCheckScoreDao;
    }

    public StandardizedManagementVo standardizedManagement(String name,String mineCode){
        StandardizedManagementVo standardizedManagementVo = new StandardizedManagementVo();
//        NormCheckScore normCheckScore = normCheckScoreDao.findByCheckName(name);
        List<NormCheckScore> normCheckScoreList = normCheckScoreDao.findAllSort(mineCode);
        NormCheckScore normCheckScore = new NormCheckScore();
        if (normCheckScoreList!=null&&normCheckScoreList.size()!=0){
            normCheckScore = normCheckScoreList.get(0);
        }else {
            return standardizedManagementVo;
        }
        //矿井总得分
        standardizedManagementVo.setCount(normCheckScore.getScoreCount());
        //通风得分
        standardizedManagementVo.setAirCirculation(normCheckScore.getScoreVentilation());
        //隐患排查得分
        standardizedManagementVo.setHiddenDanger(normCheckScore.getScoreHiddenDangerReform());
        //风险管控得分
        standardizedManagementVo.setRiskControl(normCheckScore.getScoreRiskControl());
        //地测得分
        standardizedManagementVo.setGeologicalSurvey(normCheckScore.getScoreGeologicalSurvey());
        //运输得分
        standardizedManagementVo.setTransport(normCheckScore.getScoreTransportation());
        //采煤得分
        standardizedManagementVo.setCoal(normCheckScore.getScoreMining());
        //掘进得分
        standardizedManagementVo.setDriving(normCheckScore.getScoreDrivage());
        //应急管理得分
        standardizedManagementVo.setEmergency(normCheckScore.getScoreEmergency());
        //机电得分
        standardizedManagementVo.setElectromechanical(normCheckScore.getScoreElectromechanics());
        //调度设施
        standardizedManagementVo.setDispatch(normCheckScore.getScoreEmergency());
        //职业卫生
        standardizedManagementVo.setHygiene(normCheckScore.getScoreHealthFacility());


        return standardizedManagementVo;
    }
}
